package com.jmx.controller;

import com.jmx.pojo.ResultData;
import com.jmx.pojo.User;
import com.jmx.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@CrossOrigin
public class UserController {
    @Autowired
    private IUserService userService;

    @RequestMapping("queryUsers")
    @ResponseBody
    public ResultData queryUsers(){
        return new ResultData(0,"成功",50,userService.queryUsers());
    }

    @RequestMapping(value = "queryUserByName",method = RequestMethod.POST)
    @ResponseBody
    public User queryUserByName(@RequestParam("userName") String userName){
        return userService.queryUserByName(userName);
    }
}
